package com.biz.primus.homepage.vo;

import com.biz.primus.base.enums.CommonStatus;
import com.biz.primus.homepage.enums.CoverClientType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by jiangnan on 2017/7/12.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("cover 创建更新Vo")
public class CoverUpdateVo implements Serializable {

    @ApiModelProperty("id ,唯一标识一个主页,用户填写")
    private String id;

    @ApiModelProperty("首页名称")
    private String name;

    @ApiModelProperty("首页描述")
    private String description;

    @ApiModelProperty("首页排序")
    private Integer index = 0;

    @ApiModelProperty("首页模板地址 html页面使用")
    private String url;

    @ApiModelProperty("首页模板html html页面使用")
    private String template;

    @ApiModelProperty("首页状态")
    private CommonStatus status = CommonStatus.DISABLE;

    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("首页生效时间")
    private Date startTime;

    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("首页失效时间")
    private Date endTime;

    /**
     * @see CoverClientType
     */
    @ApiModelProperty("首页类型")
    private Integer coverClientType;

    public CoverUpdateVo(CoverRoVo coverRo) {
        this.id = coverRo.getId();
        this.name = coverRo.getName();
        this.description = coverRo.getDescription();
        this.index = coverRo.getIndex();
        this.url = coverRo.getUrl();
        this.template = coverRo.getTemplate();
        this.status = coverRo.getStatus();
        this.startTime = coverRo.getStartTime();
        this.endTime = coverRo.getEndTime();
        this.coverClientType = coverRo.getCoverClientType();
    }

}
